package com.ylyq.ylxx.model.request;

import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;

/**
 * @ClassName CreatAutoStopOrOpen
 * @Description TODO
 * @Author xiaweichao
 * @Date 2020/7/2 16:06
 * @Version 1.0
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "创建自动启停规则的请求参数")
public class CreatAutoStopOrOpen {

    @ApiModelProperty(value = "广告主ID",required = true)
    private Long advertiser_id;

    @ApiModelProperty(value = "计划ID集合",required = true)
    private Long[] plans;

    @ApiModelProperty(value = "执行条件",required = true)
    private ExecutionCondition[] executionCondition;

    @NoArgsConstructor
    @AllArgsConstructor
    @Data
    @ApiModel(value = "创建自动启停规则的请求参数-规则")
    public static class ExecutionCondition {

        @ApiModelProperty(value = "数据类型。1转化成本,2转化数,3转化率,4消耗,5展示数,6点击数,7点击率,8平均点击单价")
        private Integer dataType;

        @ApiModelProperty(value = "统计数据时间。0累计，1当天，7一周，自定义多少天值就多少")
        private Integer dayNum;

        @ApiModelProperty(value = "当条件为消耗时，比较类型。0金额，1日预算")
        private Integer costCompartType;

        @ApiModelProperty(value = "比较的条件。LESS小于等于，MORE大于等于，INTERVAL介于区间，LESSBID低于出价，MOREBID高于出价")
        private String compareCondition;

        @ApiModelProperty(value = "比较条件的开始数据")
        private Double startNum;
        @ApiModelProperty(value = "比较条件的结束数据")
        private Double endNum;
        @ApiModelProperty(value = "比较条件中的比例值;当compareCondition为LESSBID|MOREBID时必填")
        private Double rate;
    }

    @ApiModelProperty(value = "执行的操作, enable表示启用, delete表示删除, disable表示暂停，changeBid表示调价至多少，upBid表示提高价格至多少，lowBid表示降低价格至多少，changeBudget表示调整预算到多少" +
            "，upBudget表示提高预算到多少,lowBudget表示降低预算到多少",required = true)
    private String operating;

    @ApiModelProperty(value = "金额值，state为changeBid、upBid、lowBid、changeBudget，upBudget，lowBudget时必填")
    private Double money;

    @ApiModelProperty(value = "执行频率",required = true)
    private ExecutionTime executionTime;
    @NoArgsConstructor
    @Data
    public static class ExecutionTime {
        @ApiModelProperty(value = "执行频率方式。0：每多少分钟执行一次，不得少于10分钟。3：每小时执行一次。1：每天几点定时执行。2：指定日期时间执行",required = true)
        private Integer type;

        @ApiModelProperty(value = "执行频率。每多少分钟执行一次就填多少，如：\"20\"，不得少于10分钟。每天几点定时执行就填时分，如“08:30”。指定日期时间执行，如”2020-09-20 17:30:00",required = true)
        private String time;
    }
}
